﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


/**/
using System.Data;


namespace MODASA.HojaDefinicionProducto
{



    public partial class HDPModelos : System.Web.UI.Page
    {
     
                 

        

        DataTable HDP;


        protected void Page_Load(object sender, EventArgs e)
        {

            
            if (Session["HDP"] == null)
            {
                CrearHDP();

            }
            else {

                

                HDP = (DataTable)Session["HDP"];

                GridView1.DataSource = HDP;
                GridView1.DataBind();
                

                for (int x=0; x < HDP.Rows.Count; x++) { 
                
                    string A = HDP.Rows[x][0].ToString();
                    string B = HDP.Rows[x][1].ToString();

                    if (A == "Modelo") {
                        TBMODELO.Text = B.ToString();                     
                    }
                    if (A == "Chasis") {
                        TBCHASIS.Text = B.ToString();
                    }

                }
                        
            }

          
        }


        private void CrearHDP()
        {

            HDP = new DataTable();
            HDP.Columns.Add("A", typeof(string));
            HDP.Columns.Add("B", typeof(string));
            Session["HDP"] = HDP;



        }



        private void Añadir_Modelo(string Modelo)
        {

              HImg1.ImageUrl = "../images/Buses/Img/" + Modelo + "/m1.jpg";
              HImg2.ImageUrl = "../images/Buses/Img/" + Modelo + "/m2.jpg";
              HImg3.ImageUrl = "../images/Buses/Img/" + Modelo + "/m3.jpg";
              HImg4.ImageUrl = "../images/Buses/Img/" + Modelo + "/m4.jpg";
              HImg5.ImageUrl = "../images/Buses/Img/" + Modelo + "/m5.jpg";
              HImg6.ImageUrl = "../images/Buses/Img/" + Modelo + "/m6.jpg";
            
              HImg1.NavigateUrl = "../images/Buses/Img/" + Modelo + "/1.jpg";
              HImg2.NavigateUrl = "../images/Buses/Img/" + Modelo + "/2.jpg";
              HImg3.NavigateUrl = "../images/Buses/Img/" + Modelo + "/3.jpg";
              HImg4.NavigateUrl = "../images/Buses/Img/" + Modelo + "/4.jpg";
              HImg5.NavigateUrl = "../images/Buses/Img/" + Modelo + "/5.jpg";
              HImg6.NavigateUrl = "../images/Buses/Img/" + Modelo + "/6.jpg";




            Añadir_Row_HDP("Modelo", Modelo);
           
        }

        private void Añadir_Chasis(string Chasis){


            Añadir_Row_HDP("Chasis",Chasis);
        }

        private  void Añadir_Row_HDP(string A, string B) {

            HDP = (DataTable)Session["HDP"];


            for (int x = 0; x < HDP.Rows.Count; x++)
            {
                string A1 = HDP.Rows[x][0].ToString();

                if (A1.ToString() == A.ToString())
                {
                    HDP.Rows.RemoveAt(x);

                }
            }

                HDP.Rows.Add(A, B);

        
        }


        protected void RBMTITAN_CheckedChanged(object sender, EventArgs e)
        {
            Añadir_Modelo(RBMTITAN.Text);
            RBLCHASIS.Items.Clear();
            RBLCHASIS.Items.Add("VAT");
            RBLCHASIS.Items.Add("HAT");
            RBLCHASIS.Items.Add("FAT");

        }
        
        protected void RBMAPOLO_CheckedChanged(object sender, EventArgs e)
        {
            Añadir_Modelo(RBMAPOLO.Text);

            RBLCHASIS.Items.Clear();
            RBLCHASIS.Items.Add("VTT");
            RBLCHASIS.Items.Add("MTT");
            RBLCHASIS.Items.Add("STT");
        }

        protected void RBMZEUS_CheckedChanged(object sender, EventArgs e)
        {
            Añadir_Modelo(RBMZEUS.Text);

            RBLCHASIS.Items.Clear();
            RBLCHASIS.Items.Add("SZI");
            RBLCHASIS.Items.Add("MZI");
            RBLCHASIS.Items.Add("VOZI");
            RBLCHASIS.Items.Add("VZI");     
  
     
        }

        protected void RBMZEUSII_CheckedChanged(object sender, EventArgs e)
        {
           

            RBLCHASIS.Items.Clear();
            RBLCHASIS.Items.Add("SZ6x2");
            RBLCHASIS.Items.Add("MZ6x2");
            RBLCHASIS.Items.Add("VOZ6x2");
            RBLCHASIS.Items.Add("MAN6X2");  
            RBLCHASIS.Items.Add("SZ8x2");  
            RBLCHASIS.Items.Add("MZ8x2");
            RBLCHASIS.Items.Add("VOZ8x2");
            Añadir_Modelo(RBMZEUSII.Text);
        }

        protected void RBMZEUSIII_CheckedChanged(object sender, EventArgs e)
        {
            Añadir_Modelo(RBMZEUSIII.Text);
        }




        protected void RBCSCANIA_CheckedChanged(object sender, EventArgs e)
        {
            Añadir_Chasis(RBCSCANIA.Text);
        }

        protected void RBCMERCEDES_CheckedChanged(object sender, EventArgs e)
        {
            Añadir_Chasis(RBCMERCEDES.Text);
        }

        protected void RBCVOLVO_CheckedChanged(object sender, EventArgs e)
        {
            Añadir_Chasis(RBCVOLVO.Text);
        }

        protected void RBCMAN_CheckedChanged(object sender, EventArgs e)
        {
            Añadir_Chasis(RBCMAN.Text);
        }

        protected void RBLCHASIS_SelectedIndexChanged(object sender, EventArgs e)
        {

        }




    }
}